package com.example.yjhticket.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.yjhticket.entity.Tickets;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 廖老师
 * @since 2023-07-19
 */
@Mapper
public interface TicketsMapper extends BaseMapper<Tickets> {
    @Select("SELECT t.*,v.venue_name as \"venues.venue_name\",v.venue_address as \"venues.venue_address\" " +
            " from tickets t,venues v where t.venue_id=v.venue_id")
    List<Tickets> selectWithVenues();

    @Select("SELECT t.*,v.venue_name as \"venues.venue_name\",v.venue_address as \"venues.venue_address\" " +
            " from tickets t,venues v where t.venue_id=v.venue_id and ticket_id=${id}")
    Tickets selectWithVenuesById(@Param("id")String id);

}
